(function (vc) {
    vc.extends({
        data: {
            deletePrivilegeInfo: {}
        },
        _initEvent: function () {
            vc.on('deletePrivilege', 'openDeletePrivilegeModel', function (_p) {
                $that.deletePrivilegeInfo = _p;
                $('#deletePrivilegeModel').modal('show');
            });
        },
        methods: {
            closeDeletePrivilegeModel: function () {
                $('#deletePrivilegeModel').modal('hide');
            },
            deletePrivilege: function () {
                console.log("开始删除限组：", $that.deletePrivilegeInfo);
                vc.http.post(
                    'deletePrivilege',
                    'delete',
                    JSON.stringify($that.deletePrivilegeInfo),
                    {
                        emulateJSON: true
                    },
                    function (json, res) {
                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                        if (res.status == 200) {
                            //关闭model
                            $('#deletePrivilegeModel').modal('hide');
                            vc.emit('privilege', 'loadPrivilege', $that.deletePrivilegeInfo.pgId);
                            vc.toast("删除成功");
                            return;
                        }
                        $that.deletePrivilegeInfo.errorInfo = json;
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                        $that.deletePrivilegeInfo.errorInfo = errInfo;
                    });
            }
        }
    });
})(window.vc);